#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;

void test(){
    vector<int> vec;
    // vec.reserve(10);
    istream_iterator<int> isi(cin);

    // copy(isi, istream_iterator<int>(), vec.begin());
    // back_inserter 的底层会调用vector的push_back()
    copy(isi, istream_iterator<int>(), back_inserter(vec));

    copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, " "));

    cout << endl;
    cout << "sizeof (vec) = " <<vec.size() <<endl;
}

int main(){
    test();
    return 0;
}